/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.cloud_siem.transform.v20220616;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.cloud_siem.model.v20220616.DescribeOperatorsResponse;
import com.aliyuncs.cloud_siem.model.v20220616.DescribeOperatorsResponse.DataItem;
import com.aliyuncs.transform.UnmarshallerContext;


public class DescribeOperatorsResponseUnmarshaller {

	public static DescribeOperatorsResponse unmarshall(DescribeOperatorsResponse describeOperatorsResponse, UnmarshallerContext _ctx) {
		
		describeOperatorsResponse.setRequestId(_ctx.stringValue("DescribeOperatorsResponse.RequestId"));
		describeOperatorsResponse.setSuccess(_ctx.booleanValue("DescribeOperatorsResponse.Success"));
		describeOperatorsResponse.setCode(_ctx.integerValue("DescribeOperatorsResponse.Code"));
		describeOperatorsResponse.setMessage(_ctx.stringValue("DescribeOperatorsResponse.Message"));

		List<DataItem> data = new ArrayList<DataItem>();
		for (int i = 0; i < _ctx.lengthValue("DescribeOperatorsResponse.Data.Length"); i++) {
			DataItem dataItem = new DataItem();
			dataItem.setOperator(_ctx.stringValue("DescribeOperatorsResponse.Data["+ i +"].Operator"));
			dataItem.setOperatorName(_ctx.stringValue("DescribeOperatorsResponse.Data["+ i +"].OperatorName"));
			dataItem.setOperatorDescCn(_ctx.stringValue("DescribeOperatorsResponse.Data["+ i +"].OperatorDescCn"));
			dataItem.setOperatorDescEn(_ctx.stringValue("DescribeOperatorsResponse.Data["+ i +"].OperatorDescEn"));
			dataItem.setSupportDataType(_ctx.stringValue("DescribeOperatorsResponse.Data["+ i +"].SupportDataType"));
			dataItem.setIndex(_ctx.integerValue("DescribeOperatorsResponse.Data["+ i +"].Index"));

			List<String> supportTag = new ArrayList<String>();
			for (int j = 0; j < _ctx.lengthValue("DescribeOperatorsResponse.Data["+ i +"].SupportTag.Length"); j++) {
				supportTag.add(_ctx.stringValue("DescribeOperatorsResponse.Data["+ i +"].SupportTag["+ j +"]"));
			}
			dataItem.setSupportTag(supportTag);

			data.add(dataItem);
		}
		describeOperatorsResponse.setData(data);
	 
	 	return describeOperatorsResponse;
	}
}